! These routines are obsolete and should be replaced by the operator  .mono.
! They originally overloaded Berz's DAVAR and should be avoided

program example
use polymorphic_complextaylor
implicit none 
integer no,nv,i,ii,j(2)
type(complextaylor) f
real(dp) r0, r(2)
complex(dp) c,cc(2)

no=4; nv= 2;    ! no: the order of the polynomial    nv: the number of variables   
call init(no,nv)  ! initializes taylor series without maps

call alloc(f)      ! must be constructed after init

j(1)=2;j(2)=1

c=cmplx(3.d0,-1.2d0,kind=dp)  
! Creates      f=REAL(c,kind=DP) + (one.mono.j(1)) +   i * (aimag(c) + (one.mono.j(2)))

f=c.var.j   ! Creates 3.d0 +  x_2  +  i  * (-1.2d0 + x_1 )

call print(f,6)

cc(1)=cmplx(5.d0,-1.4d0,kind=dp)
cc(2)=cmplx(6.d0,1.6d0,kind=dp) 
! creates cc(1)+cc(2)*((one.mono.j(1))+i_*(one.mono.j(2))) 
! therefore
! Creates (5.d0 -1.4d0 i ) + (6.d0 + 1.6d0 i )*( x_2  + x_1 i )  
f=cc.var.j     
!              = (5.d0 -1.4d0 i ) + (6.d0 + 1.6d0 i ) x_2 +  (6.d0 + 1.6d0 i )*( i*  x_1)
!              = (5.d0 -1.4d0 i ) + 6.d0 x_2 + 1.6d0 i * x_2 + 6.d0 i* x_1 -1.6d0 x_1

call print(f,6)


call kill(f)      ! must be destroyed
end program example